package IO流.转换流;

import java.io.*;

public class LineNumbe1 {
    public static void main(String[] args) {
        BufferedReader bf=null;
        BufferedWriter bw=null;
        //BufferedReader和BufferedWiter是字符缓冲区
        //inputStreamReader和OutputStreamWrither是字节转化成字符
        //FileoutputStream是文件字节输出流
        try {
            bf=new BufferedReader(new InputStreamReader(new FileInputStream("e:/a.txt")));
            bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream("e:/hah.txt")));
            String temp="";
            int i=1;
            while ((temp=bf.readLine())!=null){
                bw.write(i+""+temp);
                bw.newLine();
                i++;
            }
            bw.flush();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try {
                if (bf!=null)bf.close();
                if (bw!=null)bw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
